<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Form
 *
 * @author Jewel Tolentino
 */
class Form extends Formalistics {

    //put your code here

    public $form_name;
    public $form_table_name;
    public $form_description;
    public $form_content;
    public $form_buttons;
    public $creator;
    public $modifier;
    public $company;
    public $button_content;
    public $reference_prefix;
    public $reference_type;
    public $version;
    public $form_json;
    public $date_created;
    public $is_active;
    public $active_fields;
    public $date_updated;
    public $mobile_json_data;
    public $mobile_content;

    public function __construct($db, $id) {
        $this->init($db, $id);
    }

    public function init($db, $id) {
        $this->db = $db;
        if ($id) {
            $result = $this->db->query("SELECT * FROM tb_workspace WHERE id = {$this->db->escape($id)}", "row");
            
            $this->id = $result['id'];
            $this->form_name = $result['form_name'];
            $this->form_table_name = $result['form_table_name'];
            $this->form_description = $result['form_description'];
            $this->form_content = $result['form_content'];
            $this->form_buttons = $result['form_buttons'];
            $this->creator = new Person($this->db, $result['created_by']);
            $this->modifier = new Person($this->db, $result['updated_by']);
            $this->company = new Company($this->db, $result['company_id']);
            $this->button_content = $result['button_content'];
            $this->reference_prefix = $result['reference_prefix'];
            $this->reference_type = $result['reference_type'];
            $this->version = $result['version'];
            $this->form_json = $result['form_json'];
            $this->date_created = $result['date_created'];
            $this->is_active = $result['is_active'];
            $this->active_fields = $result['active_fields'];
            $this->date_updated = $result['date_updated'];
            $this->mobile_json_data = $result['MobileJsonData'];
            $this->mobile_content = $result['MobileContent'];
        }
    }

}

?>
